package main

import (
	"sync"

	trace "github.com/bigwhite/instrument_trace"
)

// trace2/trace.go
func A1() {
	defer trace.Trace()()
	B1()
}

func B1() {
	defer trace.Trace()()
	C1()
}

func C1() {
	defer trace.Trace()()
	D()
}

func D() {
	defer trace.Trace()()
}

func A2() {
	defer trace.Trace()()
	B2()
}
func B2() {
	defer trace.Trace()()
	C2()
}
func C2() {
	defer trace.Trace()()
	D()
}

// module11=auto
// [一] 将trace.go放到GROOT目录下，不使用go mod方式，可以go build成功

// [二] 改go.mod 增加
// require github.com/bigwhite/instrument_trace v1.0.0
// replace github.com/bigwhite/instrument_trace v1.0.0 => F:\02-go\golang\goprojects\instrument_trace

func main() {
	var wg sync.WaitGroup
	wg.Add(1)
	go func() {
		A2()
		wg.Done()
	}()

	A1()
	wg.Wait()
}
